<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>    
    <title>模块配置-模块列表</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<%@include file="/base/easyui_lib.jsp" %>
	<script type="text/javascript" src="<%=request.getContextPath()%>/js/base_ui.js"></script>
	<script type="text/javascript">
function closeWin() {
 baseui.closeWindow();
}

$(function () {
//$('body').append('<div id="myWindow" class="easyui-dialog" closed="true"></div>');
});
	function showMyWindow(title, href, width, height, modal, minimizable, maximizable) {
$('#myWindow').window({
title: title,
width: width === undefined ? 600 : width,
height: height === undefined ? 400 : height,
content: '<iframe scrolling="yes" frameborder="0"  src="' + href + '" style="width:100%;height:98%;"></iframe>',
modal: modal === undefined ? true : modal,
minimizable: minimizable === undefined ? false : minimizable,
maximizable: maximizable === undefined ? false : maximizable,
shadow: false,
cache: false,
closed: false,
collapsible: false,
resizable: false,
loadingMessage: '正在加载数据，请稍等片刻......'
});
}
  
			$(function(){
			 var table =  $('#table_list').datagrid({
				url: '<%=request.getContextPath()%>/base/module/list.action?flag=list_data',
	            striped:true,
	            singleSelect:false,
				width: 'auto',
				height: 'auto',
				fitColumns: true,
				pagination:true,
				pageSize:15,
				pageList:[10,15,20],
				rownumbers:false,
				toolbar:[{
					text:'新增',
					iconCls:'icon-add',
					handler:function(){
					    var reqUrl = '<%=request.getContextPath()%>/base/module/add.action?flag=forword';
					    var treeSelectNode = $('#treeSelectNode').val();
					    if (treeSelectNode == null || treeSelectNode == '' || treeSelectNode == 0) {
					       treeSelectNode = -1;
					    }
					    reqUrl += '&parent=' + treeSelectNode;
						var baseWin = baseui.createWindow({title:'模块配置&nbsp;->&nbsp;模块新增',
						     width:550,height:400,modal:false,url:reqUrl});
						baseWin.window({onClose:function(){
						   $('#table_list').datagrid('reload');
						   var treeNode = $('#tree_list').tree('getSelected');
						   if (treeNode != null) {
						      $('#tree_list').tree('reload',treeNode.target);
						   } else {
						      $('#tree_list').tree('reload');
						   }
						   
						}});
						
					}
				},'-',{
					text:'删除',
					iconCls:'icon-remove',
					handler:function(){
						$('#baseWindow').window('close');
						alert($('#baseWindow').length);
					}
				},'-',{
					text:'修改',
					iconCls:'icon-save',
					handler:function(){
						
					}
				}],
				columns:[[
					{field:'unid',title:'标识',width:100,checkbox:true,align:'center'},
					{field:'name',title:'模块名称',width:120,align:'center'},
					{field:'imgPath',title:'模块图片',width:120,align:'center'},
					{field:'performAction',title:'请求事件',width:120,align:'center'},
					{field:'position',title:'排序',width:50,align:'center'},
					{field:'parent',title:'父级模块',width:50,align:'center'}
				]],
				onClickRow:function(rowIndex, rowData) {
				   alert(rowData.listprice);
				},
				onDblClickRow:function(rowIndex, rowData) {
				   alert(rowData.listprice);
				},
				onClickCell:function(rowIndex, field, value) {
				   alert(value);
				}
				
			  });
			  
			  $('#tree_list').tree({
				url: '<%=request.getContextPath()%>/base/module/list.action?flag=tree',
				onClick:function(node){
				  $('#table_list').datagrid('reload',{id:node.id});
				  $('#treeSelectNode').val(node.id);
				}
			});
		    });
	</script>
  </head>
   <body class="easyui-layout">
	<div id="tree_list" region="west" border="false" style="width:200px;background-color:#F5F5F5"></div>
	<div id="table_list" region="center"></div>
	<input type="hidden" id="treeSelectNode" />
   </body>
</html>